<template>
    <div>
        <h3>当前最新的count值为：{{$store.state.count}}</h3>
        <button @click="add">+1</button>
        <input type="text" v-model="N"/>
        <button @click="addN">+N</button>
        <button @click="addAsync">一秒后+1</button>
        {{$store.getters.showNum}}
    </div>
</template>

<script>
    export default {
        name: "Addition",
        data(){
            return {
                N:0,
            }
        },
        methods:{
            add(){
                this.$store.commit('add')
            },
            addN(){
                this.$store.commit('addN',parseInt(this.N));
            },
            addAsync(){
                this.$store.dispatch('addAsync');
            }
        }
    }
</script>

<style scoped>

</style>